package com.example.system.controller.sysuser;

import com.example.common.core.domain.R;
import com.example.system.Service.sysuser.ISysUserService;
import com.example.system.domain.sysuser.dto.LoginDTO;
import com.example.system.domain.vo.LogionUserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysUser")
@Slf4j
public class SysUserController {

    @Autowired
    private ISysUserService sysUserService;

    //接口地址：/system/sysUser/login
    @PostMapping("/login")
    public R<String> login(@RequestBody LoginDTO loginDTO) {
        log.info(loginDTO.toString());
        return sysUserService.login(loginDTO);
    }

    /**
     * 获取当前用户信息接口梳理
     * 登陆成功的用户才需要获取
     */
    @RequestMapping("/info")
    public R<LogionUserVo> info(@RequestHeader String tokens){
        return sysUserService.info(tokens);
    }
}